Skip to content

Conversation

@camallen
Copy link

@camallen camallen commented Nov 14, 2025

Add rails 8 rate_limit activation error

Copy link
Collaborator

@solnic solnic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Please add tests too and we could merge this in 😄

"ActionController::NotImplemented",
"ActionController::ParameterMissing",
"ActionController::RoutingError",
"ActionController::TooManyRequests",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add it conditionally if it's rails >= 8.0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done in f4804e7

@camallen camallen force-pushed the ignore-new-rails-rate-limit-errors branch from 40128cc to f4804e7 Compare November 26, 2025 07:12
after(:initialize) do
@rails = Sentry::Rails::Configuration.new
@excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::IGNORE_DEFAULT)
@excluded_exceptions = @excluded_exceptions.concat(Sentry::Rails::RAILS_8_IGNORE_DEFAULT) if ::Rails.version.to_f >= 8.0
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Rate limit check uses wrong Rails version

The code checks for Rails 8.0 to ignore ActionController::TooManyRequests, but rate limiting was actually introduced in Rails 7.2. This means Rails 7.2 and 7.x users won't have rate limit errors ignored by Sentry, even though they have the feature. The version check, comment, and constant name all incorrectly reference Rails 8.0 instead of 7.2.

Additional Locations (2)

Fix in Cursor Fix in Web

Copy link
Author

@camallen camallen Nov 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point - however before rails 8.1.1 it used to respond with a head :too_many_requests response, not raise this new error we're ignoring, see rails/rails@73ecd0c for details.

Add Rails 8.1.1 rate limiting error to excluded exceptions conditionally.
Only applies when Rails version >= 8.1.1.
@camallen camallen force-pushed the ignore-new-rails-rate-limit-errors branch from f4804e7 to 775d6f9 Compare November 26, 2025 09:01
@camallen camallen requested a review from solnic December 1, 2025 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants